package use.thread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreeCreateThread {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ThreeCreateThread createThread = new ThreeCreateThread();
        createThread.startOne();
        createThread.startTwo();
        System.out.println(createThread.startThree());
    }

    public void startOne() {
        One one = new One();
        Thread thread = new Thread(one);
        thread.start();
    }
    public void startTwo() {
        Two two = new Two();
        two.start();
    }
    public String startThree() throws ExecutionException, InterruptedException {
        Three three = new Three();
        FutureTask<String> ft = new FutureTask<>(three);
        Thread thread = new Thread(ft);
        thread.start();
        return ft.get();
    }
}


